import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import path from 'path'
import eslintPlugin from 'vite-plugin-eslint'
// import vitePluginTemplateInset from '@yck-web/vite-plugin-template-inset'
export default defineConfig({
  plugins: [
    // vitePluginTemplateInset(["<DialogMessage ref='bellDialog' @close='closeMsg' v-if='PageIsShow'></DialogMessage>"]),
    uni(),
    eslintPlugin({
      include: ['src/**/*.vue', 'src/**/*.js'], // 检查的文件
      cache: false
    })
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    },
    extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
  },
  server: {
    proxy: {
      '/api': {
        target: 'https://j.qumoyugo.cn',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    },
    port: '3002'
  }
  // build: {
  //   minify: 'terser',
  //   terserOptions: {
  //     compress: {
  //       drop_console: process.env.NODE_ENV === 'production',
  //       drop_debugger: process.env.NODE_ENV === 'production'
  //     }
  //   }
  // }
})
